﻿<phone:PhoneApplicationPage 
    x:Class="Locima.SlidingBlock.LevelEditor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:viewModel="clr-namespace:Locima.SlidingBlock.ViewModel"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True"
    Style="{StaticResource TransitionPageStyle}">

    <phone:PhoneApplicationPage.Resources>
        <viewModel:LevelEditorViewModel x:Key="ViewModel"/>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent" DataContext="{Binding Source={StaticResource ViewModel}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" 
                       Text="{Binding Path=Strings.ApplicationName, Source={StaticResource Localization}}"
                       Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" 
                       Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"
                       Text="{Binding Path=PageTitle}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <ScrollViewer Grid.Row="1">
            <StackPanel x:Name="ContentPanel" Margin="12,0,12,0">
                <StackPanel.Resources>
                    <Style TargetType="Button" x:Key="CloseButton">
                        <Setter Property="Padding" Value="0"></Setter>
                    </Style>
                </StackPanel.Resources>
                <Button x:Name="SelectImageButtonImage" VerticalAlignment="Center" HorizontalAlignment="Center" Command="{Binding SelectImageCommand}"
                        Style="{StaticResource CloseButton}">
                    <Image x:Name="PreviewImage" Width="256" Height="256" Tap="PreviewImageTap" Source="{Binding Image}" />
                </Button>                    
                <Button x:Name="SelectImageButton" Content="{Binding Path=Strings.SelectImageButton,Source={StaticResource Localization}}"
                    Command="{Binding SelectImageCommand}" />
                <TextBlock Text="{Binding Path=Strings.ImageTitleLabel, Source={StaticResource Localization}}"/>
                <TextBox x:Name="ImageTitleText" Text="{Binding ImageTitle, Mode=TwoWay, UpdateSourceTrigger=Explicit}" TextChanged="ControlChanged" IsEnabled="{Binding IsEditable}" />
                <TextBlock Text="{Binding Path=Strings.ImageTextLabel, Source={StaticResource Localization}}"/>
                <TextBox AcceptsReturn="True" Height="160" x:Name="ImageTextText" TextWrapping="Wrap" Text="{Binding ImageText, Mode=TwoWay, UpdateSourceTrigger=Explicit}" TextChanged="ControlChanged" IsEnabled="{Binding IsEditable}" />
                <TextBlock Text="{Binding Path=Strings.LicenseLabel, Source={StaticResource Localization}}"/>
                <TextBox x:Name="LicenseText" Text="{Binding LicenseTitle, Mode=TwoWay, UpdateSourceTrigger=Explicit}" TextChanged="ControlChanged" IsEnabled="{Binding IsEditable}" />
                <TextBlock Text="{Binding Path=Strings.LicenceUriLabel, Source={StaticResource Localization}}"/>
                <TextBox x:Name="LicenseUrlText" Text="{Binding LicenseUri, Mode=TwoWay, UpdateSourceTrigger=Explicit}" TextChanged="ControlChanged" IsEnabled="{Binding IsEditable}" />
            </StackPanel>
        </ScrollViewer>
    </Grid>

</phone:PhoneApplicationPage>
